home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / CDTV / cdtvtools-11 / audio / cv.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-07  |  823 b   |  45 lines

  1. /*
  2. *    convertsound.c - Converts raw sound data back and
  3. *    forth from a Macintosh/Apple IIgs format to the Amiga
  4. *   format.
  5. *
  6. *    John Orr - May 90
  7. */
  8.  
  9. #include <exec/types.h>
  10. #include <libraries/dosextens.h>
  11.  
  12. #define BUFSIZE 32767
  13.  
  14. struct FileHandle *Open(char *, LONG);
  15.  
  16. UBYTE buffer[BUFSIZE];
  17.  
  18. void main(int argc, char **argv)
  19. {
  20.     struct FileHandle *fh_in, *fh_out;
  21.     WORD count_in, count_out, x = 0;
  22.         
  23.     if (argc != 3)
  24.     {
  25.         printf("usage:   %s <infile> <outfile>\n",argv[0]);
  26.         exit(30);
  27.     }
  28.     if (fh_in = Open(argv[1], MODE_OLDFILE))
  29.     {
  30.         if (fh_out = Open(argv[2], MODE_NEWFILE))
  31.         {
  32.             do
  33.             {
  34.                 count_in = Read(fh_in, buffer, BUFSIZE);
  35.                 for (x=0; x < count_in; x++) 
  36.                                 buffer[x] ^= 0x80;
  37.                 count_out = Write(fh_out, buffer, count_in);
  38.             } while (count_in > 0);
  39.             
  40.             Close(fh_out);
  41.         }
  42.         Close(fh_in);
  43.     }
  44. }
  45.